/**
*    Copyright (C) 2008  Chase Kernan 
*    chase.kernan@gmail.com
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.
* 
**/

package com.chasekernan.hxnova.client.mapviewer;

import flash.display.Sprite;
import flash.geom.Rectangle;
import com.chasekernan.hxnova.utils.Vector;
import com.chasekernan.hxnova.core.SpaceObject;
import com.chasekernan.hxnova.core.fleets.Salvage;
import com.chasekernan.hxnova.core.players.Player;

class SalvageObject extends Sprite, implements IMapObject {
    
    public static var RADIUS = 2;
    public static var LINE_THICKNESS = 0.5;
    public static var COLOR = 0xCCCC00;

    public var salvage : Salvage;
    
    public function new(salvage : Salvage) {
        super();
        
        this.salvage = salvage;
    }
    
    public function getObject() : SpaceObject {
        return salvage;
    }
    
    public function draw(bounds : Rectangle, player : Player, 
                         options : MapOptions) {
        graphics.clear();
        
        var loc = salvage.location;
        x = loc.x - bounds.x;
        y = loc.y - bounds.y;
        
        graphics.lineStyle(LINE_THICKNESS, COLOR);
        
        graphics.moveTo(0, -RADIUS);
        graphics.lineTo(RADIUS, 0);
        graphics.lineTo(0, RADIUS);
        graphics.lineTo(-RADIUS, 0);
        graphics.lineTo(0, -RADIUS);
    }
}